<template>
  <div>
    我是子组件   {{inputValue}}
    <!-- <input type="text" :value="moduleValue" @input="change($event)" > -->
    <input type="text" v-model="inputValue" />
  </div>

  
</template>

<script setup>
import { defineProps,defineEmits } from "vue";
import {computed} from "vue";
const props=defineProps({
  moduleValue: {
    type: Number,
    default: 0,
  },
});
const emit = defineEmits(['update:moduleValue'])
const inputValue=computed({
 get:()=>props.moduleValue || 0,
 set:val=>{
  emit('update:moduleValue',val)
 }
})
const change = (e)=>{
  console.log(moduleValue);
  console.log(e.target.value);
  emit('update:moduleValue',e.target.value);
}

</script>

<style lang="scss" scoped></style>
